package com.lzclass.service.whyservice.Impl;


import com.lzclass.dao.whydao.ArcitleMapper;
import com.lzclass.pojo.Article;

import com.lzclass.pojo.BackMessage;
import com.lzclass.service.whyservice.ArcitleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.CrossOrigin;

import java.util.List;

@Service
public class ArcitleServiceImpl implements ArcitleService {
    @Autowired
    private ArcitleMapper arcitleMapper;



    @Override
    public List<Article> allArcitle() {
        return arcitleMapper.findArcitle();
    }

    @Override
    public List<Article> allfindArcitleByType(String typename) {
        return arcitleMapper.allfindArcitleByType(typename);
    }

    @Override
    public List<Article> allfindArcitleByTitle(String title) {
        return arcitleMapper.allfindArcitleByTitle(title);
    }

    @Override
    public List<Article> findArcitleBytime() {
        return arcitleMapper.findArcitleBytime();
    }

    @Override
    public List<Article> allfindBycountAid() {
        return arcitleMapper.allfindBycountAid();
    }

    @Override
    public List<Article> allfindByAid(int aid) {
        return arcitleMapper.allfindByAid(aid);
    }

    @Override
    public List<Article> arcitleByuid(int uid) {
        return arcitleMapper.arcitleByuid(uid);
    }

    @Override
    public String addmessage(BackMessage backMessage) {
        Integer integer = arcitleMapper.allFindByBack(backMessage.getAid(), backMessage.getUid(), backMessage.getMessageinfo(), backMessage.getMessagetime());
        if (integer>0){
            return "添加成功";
        }else {
            return "添加失败";
        }
    }

    @Override
    public List<BackMessage> allmessage(int aid, int uid) {
        return arcitleMapper.allMessage(aid,uid);
    }

}
